import { wxConfigGet,wxConfigPut } from '@/api/wx'

export default {
  namespaced: true,
  state: {
    currentItem: {}
  },
  mutations: {
    selectAccount (state, wxAccount) {
      wxConfigPut(wxAccount).then(rseponse => {
        state.currentItem = wxAccount
      })
    }
  },
  actions: {
    GetConfig({ commit, state }) {
      return new Promise((resolve, reject) => {
        wxConfigGet().then(response => {
          const wxAccount = response.data.wxAccount
          state.currentItem = wxAccount
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    }
  }

}
